﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace DTGroup_ZheJiang.WebUI.Code
{
    public class BasePage : System.Web.UI.Page
    {
        /// <summary>
        /// 根据参数获取表名
        /// </summary>
        /// <param name="type"></param>
        /// <param name="city"></param>
        /// <returns></returns>
        public string getTabName(string type, string city)
        {
            string tabName = "";
            switch (type)
            {
                case "HomeWifi":
                    tabName = "HW_";
                    break;
                case "WiFi":
                    tabName = "WIFI_";
                    break;
                case "OTT":
                    tabName = "OTT_";
                    break;
                case "MA":
                    tabName = "MA_";
                    break;
                case "ZT":
                    tabName = "ZT_";
                    break;
                case "ALL":
                    tabName = "All_";
                    break;
                default:
                    tabName = "HW_";
                    break;
            }
            switch (city)
            {
                case "hangzhou":
                    tabName += "571";
                    break;
                case "ningbo":
                    tabName += "574";
                    break;
                case "wenzhou":
                    tabName += "577";
                    break;
                case "shaoxing":
                    tabName += "575";
                    break;
                case "huzhou":
                    tabName += "572";
                    break;
                case "jiaxing":
                    tabName += "573";
                    break;
                case "jinhua":
                    tabName += "579";
                    break;
                case "quzhou":
                    tabName += "570";
                    break;
                case "taizhou":
                    tabName += "576";
                    break;
                case "lishui":
                    tabName += "578";
                    break;
                case "zhoushan":
                    tabName += "580";
                    break;
                default:
                    break;
            }
            return tabName;
        }

        /// <summary>
        /// Reponse.Writer输出Json格式字符串
        /// </summary>
        /// <param name="status">0：为操作成功，1：操作失败。</param>
        /// <param name="message">信息</param>
        protected void JsonWriter(int status, string message)
        {
            Response.Write(string.Concat("{\"status\":\"", status, "\",\"msg\":\"", message, "\"}"));
            Response.End();
        }
        protected void JsonWriter2(string fileName, string address)
        {
            Response.Write(string.Concat(fileName + "," + address));
            Response.End();
        }
    }
}